package com.example.chat

import com.example.chat.dao.TopicDao
import com.example.chat.model.Topic
import com.example.featuresdk.event.FeatureService
import com.example.featuresdk.event.ServiceMediator

class TopicFeatureService constructor(private val topicDao: TopicDao): FeatureService {

    override fun path(): String = "topic/create"

    override suspend fun execute(params: Map<String, Any>) {

        val topic = Topic(id = params["id"] as Long, title = params["title"] as String, logo = params["logo"] as Int)

        topicDao.insert(topic)
    }

    init {
        ServiceMediator.register(path(), this)
    }
}